<template>
  <div class="searchWrapper">
    <div class="search">
      <i class="iconfont icon-sousuo"></i>
      <input v-model="keyword" :placeholder="placeholder" @blur="search" @keyup.enter="search" />
    </div>
  </div>
</template>

<script lang="ts">
import { Component, Vue } from 'nuxt-property-decorator'
@Component({
  props: ['placeholder'],
})
export default class Search extends Vue {
  keyword: string = ''
  search() {
    this.$emit('on-search', this.keyword)
  }
}
</script>

<style lang="scss" scoped>
.search {
  display: flex;
  align-items: center;
  margin-left: 74px;
  i {
    cursor: pointer;
    font-size: 40px;
    color: #fff;
  }
  input {
    text-indent: 10px;
    margin-left: 10px;
    outline: none;
    border: none;
    height: 40px;
    color: #fff;
    background: #171821;
    width: 540px;
    border: 1px solid rgba(71, 75, 84, 1);
    border-radius: 4px;
    //::-webkit-input-placeholder/* WebKit, Blink, Edge */
    //:-moz-placeholder/* Mozilla Firefox 4 to 18 */
    //::-moz-placeholder  /* Mozilla Firefox 19+ */
    //:-ms-input-placeholder /* Internet Explorer 10-11 */
    //::-ms-input-placeholder  /* Microsoft Edge */
    &::placeholder,
    &::-webkit-input-placeholder,
    &:-moz-placeholder,
    &::-moz-placeholder,
    &:-ms-input-placeholder,
    &::-ms-input-placeholder {
      color: rgba(71, 75, 84, 1);
      font-size: 16px;
    }

    &:focus {
      border: 1px solid #fff;
    }
  }
}
</style>
